package com.naton.common.extensions

import android.app.Activity
import android.content.Intent
import android.view.View
import androidx.annotation.IdRes

/**
 * @time: 2022/1/26
 * @author: lifuling
 * @version: v1.0
 * @file_desc:Activity的扩展函数
 */

/**
 * 获取控件
 */
fun <T : View> Activity.find(@IdRes id : Int) : T{
    return findViewById(id)
}

/**
 * 启动activity
 */
fun Activity.startActivity(cls : Class<*>){
    startActivity(Intent(this , cls))
}

/**
 * 启动activity
 */
fun Activity.startActivityForResult(cls : Class<*> , requestCode : Int){
    startActivityForResult(Intent(this , cls) , requestCode)
}